<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.01.
   广告位置控制器($$)*/

!defined('Q_PATH') && exit;

class Adposition_C_Controller extends InitController{

	public function index(){
		$sAdpositionapp=trim(Q::G('adposition_app','G'));
		$nAdpositionId=intval(Q::G('adposition_id','G'));
		$nIsfirst=intval(Q::G('isfirst','G'));
		$nIsdata=Q::G('isdata','G');

		// 查询广告位
		$arrWhere=array();
		$arrWhere['adposition_status']=1;
		if($sAdpositionapp){
			$arrWhere['adposition_app']=$sAdpositionapp;
		}
		if($nIsdata!==NULL && $nIsdata!==''){
			$arrWhere['adposition_isdata']=$nIsdata;
		}

		$arrPositions=Model::F_('adposition')
			->where($arrWhere)
			->setColumns('adposition_id,adposition_name,adposition_type')
			->getAll();

		if($nIsfirst==1){
			echo '<option value="" atype="">- 请选择 -</option>';
		}
		foreach($arrPositions as $arrPosition){
			echo "<option value=\"{$arrPosition['adposition_id']}\" atype=\"{$arrPosition['adposition_type']}\" ".($nAdpositionId && $arrPosition['adposition_id']==$nAdpositionId?'selected':'').">{$arrPosition['adposition_name']}</option>";
		}
	}

}
